/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package BufferLayerMapBean;
import Buffer.*;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Toshiba
 */
public class Painter implements Runnable{

    List<Flight> FlightList = new ArrayList<Flight>();
    FlightData FlightData;

    public Painter (FlightData flightdata)
    {
        this.FlightData = flightdata;
    }
    
    public void run() {
       while (true)
       {
           synchronized (FlightData)
           {
                FlightList = FlightData.getFlightList();
                System.out.println("*** PAINTER GET DATA ***");
                for (int i = 0; i < FlightList.size(); i++)
                {
                    System.out.println("Call sign : " + FlightList.get(i).getCallSign());
                    System.out.println("Latitude : " + FlightList.get(i).getLatitude());
                    System.out.println("Longitude : " + FlightList.get(i).getLongitude());
                    System.out.println("Last Update: " + FlightList.get(i).getLastUpdate());
                }
                System.out.println("*** END OF PAINTER ***\n");
           }

           //Sleep for 0.5 second
           try {
                    Thread.sleep(500);
                } catch (InterruptedException ex) {
                    Logger.getLogger(Painter.class.getName()).log(Level.SEVERE, null, ex);
                }
       }
    }

    public static void main(String[] args) {
        // TODO code application logic here
    }
}
